{% if section.settings.collection.id %}
{% get_collection collections_id={section.settings.collection.id} %}
{% assign collection = collection  %}
{% endif %}
<div class="block_collection_list">
    <div class="container_wrapper">
      <div class="{% if section.settings.is_hr %}show_hr{% endif %}">
        {% include 'title',title:section.settings.title,detaile:section.settings.detail,textAlgin: section.settings.text_align %}
      
        <div class="collection_product" style="--pc_number:{{section.settings.pc_number}};--wap_number:{{section.settings.wap_number}}">
          {% get_products collection_id = {section.settings.collection.id} limit = { section.settings.product_number } %}
          {%- if products.size > 0 -%}
          {% for product in products %}
          {% include 'collection_product',product:product, collection_handle:collection.handle %}
          {% endfor %}
          {%- else -%}
          {%- for i in (1..8) -%}
          {% include "collection_product" %}
          {%- endfor -%}
          {%- endif -%}
        </div>
        {% if section.settings.more != '' %}
        <div class="more">
          <div class="animation_btn">
            <a href="/collections/{{collection.handle}}" class="secondary_btn">
              <span>{{section.settings.more}}</span>
              <svg viewBox="0 0 22 14" fill="none" aria-hidden="true" focusable="false" role="presentation"
                class="icon icon-button-arrow" xmlns="http://www.w3.org/2000/svg">
                <path
                  d="M15.1712 1.15214L14.9895 0.98149L14.8183 1.16262L14.3286 1.68074L14.1561 1.86323L14.3393 2.03491L18.9951 6.39689L1 6.3969L0.75 6.3969L0.75 6.6469L0.75 7.35665L0.75 7.60665L1 7.60665L18.9955 7.60665L14.3393 11.9722L14.1549 12.1451L14.3298 12.3276L14.8195 12.8386L14.9907 13.0173L15.1711 12.8479L21.2041 7.18404L21.3981 7.00183L21.2041 6.81956L15.1712 1.15214Z"
                  fill-rule="evenodd" clip-rule="evenodd" fill="currentColor"></path>
              </svg>
            </a>
          </div>
        </div>
        {% endif %}
      </div>
    </div>
</div>
{% schema %}
{
	"tag": "",
	"class": "block_collection_list",
	"icon": "icon-zhuanjishangpin",
	"is_global": false,
	"name": {
		"zh_CN": "专辑商品",
		"en_US": "Collection"
	},
	"max_blocks": "",
	"settings": [
		{
			"type": "card_header",
			"label": {
				"zh_CN": "设置",
				"en_US": "Settings"
			}
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "是否显示分割线",
				"en_US": "Show split line"
			},
			"default": true,
			"id": "is_hr"
		},
		{
			"type": "card_collection",
			"label": {
				"zh_CN": "选择专辑",
				"en_US": "Select collection"
			},
			"default": {
				"id": "",
				"title": ""
			},
			"id": "collection"
		},
		{
			"type": "card_select",
			"label": {
				"zh_CN": "标题对齐方式",
				"en_US": "Title alignment"
			},
			"default": "left",
			"id": "text_align",
			"option": [
				{
					"value": "left",
					"label": {
						"zh_CN": "居左",
						"en_US": "To the left"
					}
				},
				{
					"value": "center",
					"label": {
						"zh_CN": "居中",
						"en_US": "In the center"
					}
				},
				{
					"value": "right",
					"label": {
						"zh_CN": "居右",
						"en_US": "To the right"
					}
				}
			]
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "标题",
				"en_US": "Title"
			},
			"id": "title",
			"default": "New Arrivals"
		},
		{
			"type": "card_text_editor",
			"label": {
				"zh_CN": "简短描述",
				"en_US": "Short description"
			},
			"id": "detail",
			"default": "bottom_center"
		},
		{
			"type": "card_input_number",
			"label": {
				"zh_CN": "产品总数量",
				"en_US": "Total quantity of products"
			},
			"max": 1000,
			"min": 1,
			"id": "product_number",
			"default": 8
		},
		{
			"type": "card_slider",
			"label": {
				"zh_CN": "PC每排数量",
				"en_US": "PC number per row"
			},
			"id": "pc_number",
			"max": "5",
			"min": "3",
			"default": "4"
		},
		{
			"type": "card_slider",
			"label": {
				"zh_CN": "移动端每排数量",
				"en_US": "Number of mobile terminals per row"
			},
			"id": "wap_number",
			"max": "2",
			"min": "1"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "查看更多",
				"en_US": "See more"
			},
			"id": "more",
			"default": "View More"
		}
	],
	"blocks": [],
	"default": {
		"settings": {
			"collection": {
				"id": "",
				"title": ""
			},
			"text_align": "left",
			"is_hr": true,
			"title": "Best Selling",
			"detail": "",
			"product_number": "8",
			"pc_number": "4",
			"wap_number": "2",
			"more": "View More"
		},
		"blocks": []
	}
}
{% endschema %}